Dynamic Reporting

Workshop at the UZH Reproducibility Day 2023

Samuel Pawel and Felix Hofmann

Center for Reproducible Science (CRS)

Schedule

  1. What is dynamic reporting?

  2. How to do dynamic reporting?

  3. Hands-on exercises

Manual reporting workflow

What are the disadvantages?

  • tedious and error-prone
  • not directly reproducible
  • difficult to share/reuse
  • new data → need to repeat everything

Dynamic reporting workflow

R Markdown

  • R programming language
    (> 60 other also possible)

  • .Rmd files (edit in RStudio, VS Code, etc.)

  • Markup language: Markdown

  • HTML, PDF, DOCX output formats (and more)

  • rmarkdown is an R package

knitr

  • Programming language: R
    (> 60 other also possible)

  • .Rnw files (edit in RStudio, VS Code, etc.)

  • Markup languages: LaTeX
    (+ HTML, Markdown, and more)

  • HTML, PDF, DOCX output formats (and more)

  • knitr is an R package

Quarto

  • Programming language: R, Python, Julia

  • .qmd files (edit in RStudio, VS Code, etc.)

  • Markup language: Markdown

  • HTML, PDF, DOCX output formats (and more)

  • Evolution of R Markdown (introduced in 2022)

  • quarto is a separate program

Which tool for whom?

  • rmarkdownR users (beginner to advanced)
  • knitrR+LaTeX users (intermediate to advanced)
  • quartoR/Python/Julia users (beginner to advanced)

Exercises

  1. Download the data sets on accidents in Zurich from https://github.crsuzh/dynamicReporting/XXXXX.

  2. Explore the data from the 2020. Compute the number of accidents for each weekday and month. Make a chart of the number of accidents vs. weekday, and a chart of the number of accidents vs. month. Create an HTML report using either R Markdown or Quarto.

  3. Now use the data from 2020 and 2021 and rerun your analysis. Create an updated report.

  4. Bonus: Convert your report to a presentation.